<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="XMLSerializer.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>XMLSerializer.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'XMLSerializer.js'<BR/><BR/>
	
</p>

<hr>



<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/* This notice must be untouched at all times.

FreeGroup Draw2D 0.9.26
The latest version is available at
http://www.freegroup.de

Copyright (c) 2006 Andreas Herz. All rights reserved.
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )

LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
or see http://www.gnu.org/copyleft/lesser.html
*/</span>
draw2d.XMLSerializer=<span class="reserved">function</span>()
{
   alert(<span class="literal">"do not init this class. Use the static methods instead"</span>);
};


draw2d.XMLSerializer.toXML=<span class="reserved">function</span>(obj, objectName, indentSpace)
{
   <span class="reserved">if</span>(objectName == undefined)
       objectName = <span class="literal">"model"</span>;
   indentSpace = indentSpace?indentSpace:<span class="literal">''</span>;

   var t = draw2d.XMLSerializer.getTypeName(obj);
   var s = indentSpace  + <span class="literal">'&lt;'</span> + objectName +  <span class="literal">' type="'</span> + t + <span class="literal">'"&gt;'</span>;

   switch(t)
   {
      case <span class="literal">"int"</span>:
      case <span class="literal">"number"</span>:
      case <span class="literal">"boolean"</span>:
         s += obj; 
         break;
      case <span class="literal">"string"</span>:
         s += draw2d.XMLSerializer.xmlEncode(obj);
         break;
      case <span class="literal">"date"</span>:
         s += obj.toLocaleString();
         break;
      case <span class="literal">"Array"</span>:
      case <span class="literal">"array"</span>:
         s += <span class="literal">"\n"</span>;
         var indentSpace_plusOne = indentSpace + <span class="literal">"   "</span>;
         <span class="reserved">for</span>(var i =0;i&lt;obj.length;i++)
         {
            s += draw2d.XMLSerializer.toXML(obj[i], (<span class="literal">'element'</span>),indentSpace_plusOne );
         }
         s += indentSpace;
         break;
      default:
         <span class="reserved">if</span>(obj!==null)
         {
            s += <span class="literal">"\n"</span>;
            <span class="reserved">if</span>(obj instanceof  draw2d.ArrayList)
               obj.trimToSize();

            var attributes = obj.getPersistentAttributes();
            var indentSpace_plusOne = indentSpace + <span class="literal">"   "</span>;
            <span class="reserved">for</span>(var name in attributes)
            {
               s += draw2d.XMLSerializer.toXML(attributes[name], name, indentSpace_plusOne);
            }
            s += indentSpace;
         }
      break;
    }
    s += <span class="literal">"&lt;/"</span> + objectName + <span class="literal">"&gt;\n"</span>;
    <span class="reserved">return</span> s;
};



draw2d.XMLSerializer.isSimpleVar=<span class="reserved">function</span>(t)
{
   switch(t)
   {
      case <span class="literal">"int"</span>:
      case <span class="literal">"string"</span>:
      case <span class="literal">"String"</span>:
      case <span class="literal">"Number"</span>:
      case <span class="literal">"number"</span>:
      case <span class="literal">"Boolean"</span>:
      case <span class="literal">"boolean"</span>:
      case <span class="literal">"bool"</span>:
      case <span class="literal">"dateTime"</span>:
      case <span class="literal">"Date"</span>:
      case <span class="literal">"date"</span>:
      case <span class="literal">"float"</span>:
      <span class="reserved">return</span> true;
   }

   <span class="reserved">return</span> false;
};


draw2d.XMLSerializer.getTypeName=<span class="reserved">function</span>(obj)
{
   <span class="reserved">if</span> (obj===null)
      <span class="reserved">return</span> <span class="literal">"undefined"</span>;
   <span class="reserved">if</span> (obj instanceof Array)
      <span class="reserved">return</span> <span class="literal">"Array"</span>;
   <span class="reserved">if</span> (obj instanceof Date)
      <span class="reserved">return</span> <span class="literal">"Date"</span>;

   var t  = typeof(obj);

   <span class="reserved">if</span>(t==<span class="literal">"number"</span>)
      <span class="reserved">return</span> (parseInt(obj).toString() == obj)?<span class="literal">"int"</span>:<span class="literal">"number"</span>;


   <span class="reserved">if</span> (draw2d.XMLSerializer.isSimpleVar(t))
      <span class="reserved">return</span> t;

   <span class="comment">// don't remove the "+" in the string. The string will be replace during the build.xml run if you</span>
   <span class="comment">// remove this.</span>
   <span class="reserved">return</span> obj.type.replace(<span class="literal">"@NAMESPACE"</span>+<span class="literal">"@"</span>,<span class="literal">""</span>);
};


draw2d.XMLSerializer.xmlEncode=<span class="reserved">function</span>(textToEncode)
{
  var result = textToEncode;
  
  var amp = /&amp;/gi;
  var gt = /&gt;/gi;
  var lt = /&lt;/gi;
  var quot = /<span class="literal">"/gi;
  var apos = /'/gi;
  
  var xml_gt = "</span>&amp;#62;<span class="literal">";
  var xml_lt = "</span>&amp;#38;#60;<span class="literal">";
  var xml_amp = "</span>&amp;#38;#38;<span class="literal">";
  var xml_quot = "</span>&amp;#34;<span class="literal">";
  var xml_apos = "</span>&amp;#39;";
  
  result = result.replace(amp, xml_amp);
  result = result.replace(quot, xml_quot);
  result = result.replace(lt, xml_lt);
  result = result.replace(gt, xml_gt);
  result = result.replace(apos, xml_apos);
  <span class="reserved">return</span> result;
}</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Mon Nov 14 13:45:39 2011</div>
</body>
</html>
